<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template name="replace">
    <xsl:param name="string"/>
    <xsl:choose>
      <xsl:when test="contains($string,'&#10;')">
        <xsl:value-of select="substring-before($string,'&#10;')"/>
        <br/>
        <xsl:call-template name="replace">
          <xsl:with-param name="string"
			  select="substring-after($string,'&#10;')"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$string"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


  <xsl:template match="/project">
    <html>
      <head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
	<title><xsl:value-of select="@project"/>&#160;Schema for Version&#160;
	  <xsl:value-of select="@version"/></title>
	<link rel="stylesheet" type="text/css" href="stylesheet.css"></link>
      </head>
      <body>
	<table bgcolor="#eeeeff" cellspacing="0" cellpadding="1" border="0" width="100%" summary="">
	  <tr>
	    <td>
	      <table cellspacing="3" cellpadding="0" border="0" summary="">
		<tr align="center" valign="top">
		  <td>
		    <a href="summary.html">
		      <font class="NavBarFont">
			<b>Overview</b>
		      </font>
		    </a>
		  </td>
		</tr>
	      </table>
	    </td>
	  </tr>
	</table>
	<center>
	  <h1>
	    <xsl:value-of select="@project"/>&#160;Schema Documentation 
	    <br></br>
	    Version&#160;<xsl:value-of select="@version"/>
	  </h1>
	</center>
	<p>
	  <xsl:value-of select="@description"/>
	</p>
	<table cellspacing="0" cellpadding="3" border="1" width="100%" summary="">
	  <tr class="TableHeadingColor">
	    <th align="left" colspan="2">
	      <b>List of Tables</b>
	    </th>
	  </tr>
	  <xsl:for-each select="schema/table">
	    <xsl:sort select="@name"/>
	    <tr class="TableRowColor">
	      <td width="20%">
		<xsl:element name="a">
		  <xsl:attribute name="href">
		    <xsl:value-of select="@schema"/>/tables/<xsl:value-of select="@name"/>.html
		  </xsl:attribute>
		  <b><xsl:text><xsl:value-of select="@name"/></xsl:text></b>
		</xsl:element>

	      </td>
	      <td>
		<xsl:if test="@comment = ''">&#160;</xsl:if>
		<xsl:if test="@comment != ''">
		  <xsl:call-template name="replace">
        	    <xsl:with-param name="string" select="@comment"/>
    		  </xsl:call-template>
		</xsl:if>
	      </td>
	    </tr>
	  </xsl:for-each>
	</table>
	<p></p>
	<div id="footer">
	  <i><small>Last change date :&#160;<xsl:value-of select="@dateChanged"/></small></i>
	  <hr></hr>
	  <center>
	    <a href="http://Jingsy.gaixie.org">Jingsy Powered</a>&#160;&#160;<a href="http://www.gnu.org/copyleft/fdl.html">GPL licensed</a>
	  </center>
	</div>
      </body>
    </html>
  </xsl:template>

</xsl:stylesheet>
